Add `--force` flag to cargo install
authorGleb Kozyrev <gleb@gkoz.com>
Fri, 15 Apr 2016 11:20:45 +0000 (14:20 +0300)
committerGleb Kozyrev <gleb@gkoz.com>
Sat, 30 Apr 2016 23:40:38 +0000 (02:40 +0300)
commit9ea1f2af548992201cb2985874ae93937facfcf2
tree335de208f5cd9799ba73a76c96339e1deafb8b22
parent2d84f3e7dd70929c7f671366cae610e01d8e7ed9
Add `--force` flag to cargo install

Close #2082

Adding `--force` (`-f`) instructs cargo to overwrite existing binaries
(updating the metadata accordingly).
This allows updating crates via `cargo install -f <crate>`.

Installation happens in two stages now: binaries are copied into a
temporary subdirectory of the destination first, then moved into
destination. This should catch some errors earlier.

In case of installation error cargo will remove new binaries but won't
attempt to undo successful overwrites.
src/bin/install.rs
src/cargo/ops/cargo_install.rs
tests/support/mod.rs
tests/test_cargo_install.rs